<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
//登录
Route::post('login','Login/doLogin');

Route::post('get_xcx_token', 'Login/getXcxToken');   //小程序获取用户token
Route::post('token_verify', 'Login/tokenVerify');


Route::group('admin',function (){
    /**
     * 菜单
     */
    //获取菜单权限
    Route::get('permission', 'Menu/menuPermission');
    //菜单
    Route::get('menu_list', 'Menu/MenuInfo');
    //新增and编辑
    Route::post('menuSave', 'Menu/MenuSave');
    //删除菜单
    Route::get('menuDel/:id', 'Menu/MenuDel');
    //添加子菜单
    Route::post('child_save', 'Menu/childSave');
    //获取菜单类别
    Route::get('menuType', 'Menu/MenuType');

    /**
     * 用户
     */
    //获取用户信息
    Route::get('admin_show', 'Login/adminShow');
    //用户列表
    Route::get('user_list', 'Admin/userList');
    //用户更新
    Route::get('update_show/:id', 'Admin/userUpdateShow');
    //用户保存
    Route::post('user_save', 'Admin/userSave');
    //删除用户
    Route::get('user_delete/:id', 'Admin/userDelete');

    /**
     * 角色
     */
    //获取角色列表 代树
    Route::get('role_list', 'Role/roleList');
    //读取所有角色
    Route::get('role_info_list', 'Role/roleInfoList');
    //保存中间表角色
    Route::post('set_role_user_pivot', 'Role/setRoleUserPivot');
    //新增and编辑角色
    Route::post('save_role', 'Role/saveRole');
    //更改角色状态
    Route::put('update_role_status/:id/:status', 'Role/updateRoleStatus');
    //删除角色
    Route::delete('del_role/:id/:role_id', 'Role/delRole');
    //删除角色组
    Route::delete('del_group/:id', 'Role/groupDel');



    /**
     * 问卷
     */
    Route::get('question_list', 'Question/getQuestionList');
    //保存and编辑
    Route::post('save_question', 'Question/saveQuestion');
    //删除
    Route::delete('del_question/:id', 'Question/QuestionDel');
    //导入问卷
    Route::post('import_excel', 'Question/importExcel');
    //查看问卷
    Route::get('check_question_info', 'Question/getCheckQuestionInfo');
    //获取题目类型
    Route::get('select_type_data', 'Question/getSelectTypeData');

    //保存变更题目类型
    Route::post('save_change_type', 'Question/saveChangeType');
    Route::get('change_answer_type/:id', 'Question/changeAnswerType');
    Route::get('change_is_write/:id', 'Question/changeIsWrite');

    Route::get('get_topic_list/:id', 'Question/getQuestionTopicList');
    Route::post('save_jump_topic', 'Question/saveJumpTopic');


})->middleware(\app\middleware\AuthCheck::class);
Route::group('wx',function (){
    Route::post('wx_login','Login/wxLogin');
    Route::get('question_list', 'Question/questionOneList');
    Route::get('question_answer_status', 'Question/getQuestionAnswer');
    Route::post('save_question_info_write','Question/saveQuestionInfoAndWrite');
    Route::post('question_answer_dx', 'Question/getQuestionAnswerType');
    Route::get('question_info', 'Question/getQuestionInfo');

    //微信登录
    Route::post('verify_user','Login/verifyUser');
})->middleware(\app\middleware\wxAuthMiddleware::class);
Route::get('wx_question_list', 'Question/getQuestionList');
Route::get('import_question', 'Question/importQuestion');
Route::get('aaaa', 'Question/questionOneList');

